/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package tletlis.model;

import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author Gustav
 */
public class RowList {

    private List<Row> rowList;

    public RowList(int nrOfRows, int RowWidth) {
        rowList = new ArrayList<Row>();
        for(int i = 0; i < (nrOfRows); i++) {
            rowList.add(new Row(i,RowWidth));
            
        }

    }

    public GamePosition getPosition(Position p) {
        Row tempRow = getRowList().get((p.getY()/Position.getLength()));
        return tempRow.getPosition(p);
    }

    /**
     * @return the rowList
     */
    public List<Row> getRowList() {
        return rowList;
    }

    public List<GamePosition> removeLast() {
        List<GamePosition> temp = rowList.get(rowList.size()-1).getGamePosList();
        rowList.remove(rowList.size()-1);
        return temp;
    }
}
